import Mock from 'mockjs2'
import {builder, getQueryParameters} from "@/mock/util";

const totalCount = 10

const reportList = (options) => {
	console.log(' mock: report list')
	console.log(options)
	const data = [
		{"id":1,"reportId":1,"name":"report1","remark":"报表1","updatedAt":"2021-09-15 15:24:15","creatorName":"admin"},
		{"id":2,"reportId":2,"name":"report2","remark":"报表2","updatedAt":"2021-09-15 15:24:15","creatorName":"admin2"},
		{"id":3,"reportId":3,"name":"report3","remark":"报表3","updatedAt":"2021-09-15 15:24:15","creatorName":"admin"},
		{"id":4,"reportId":4,"name":"report4","remark":"报表4","updatedAt":"2021-09-15 15:24:15","creatorName":"admin3"},
		{"id":5,"reportId":5,"name":"report5","remark":"报表5","updatedAt":"2021-09-15 15:24:15","creatorName":"aadfan"},
		{"id":6,"reportId":6,"name":"report6","remark":"报表6","updatedAt":"2021-09-15 15:24:15","creatorName":"adming"},
		{"id":17,"reportId":17,"name":"report17","remark":"报表17","updatedAt":"2021-09-15 15:24:15","creatorName":"ytjy"},
	]
	const result = builder(data)
	return result
}


const announcementList = (options) => {
	console.log(' mock: announcement list')
	console.log(options)
	const data = [
		{"id":1,"title":"announcement1","content":"公告xxxxxxx2\n公告xxxxxxx公告\nxxxxxxx2公告\nxxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2公告xxxxxxx2","createdAt":"2021-09-15 15:24:15","creatorName":"admin"},
		{"id":2,"title":"announcement2","content":"公告xxxxxxx2","createdAt":"2021-09-15 15:24:15","creatorName":"admin2"},
		{"id":3,"title":"announcement3","content":"公告xxxxxxx3","createdAt":"2021-09-15 15:24:15","creatorName":"admin"},
		{"id":4,"title":"announcement4","content":"公告xxxxxxx4","createdAt":"2021-09-15 15:24:15","creatorName":"admin3"},
		{"id":5,"title":"announcement5","content":"公告xxxxxxx5","createdAt":"2021-09-15 15:24:15","creatorName":"aadfan"},
		{"id":6,"title":"announcement6","content":"公告xxxxxxx6","createdAt":"2021-09-15 15:24:15","creatorName":"adming"},
		{"id":7,"title":"announcement7","content":"公告xxxxxxx7","createdAt":"2021-09-15 15:24:15","creatorName":"ytjy"},
	]
	const result = builder({
		data:data,
		total:7,
		current:1,
		size:10
	})
	return result
}


const overviewData = (options) => {
	console.log(' mock: overview data')
	console.log(options)
	return builder({
		created: 100,
		sharedTo: 20,
		sharedFrom: 30
	})
}

Mock.mock(/^.*?\/smartreportservice\/report\/follow[^\/]*?/, 'get', reportList)
Mock.mock(/^.*?\/smartreportservice\/announcement.*?/, 'get', announcementList)
Mock.mock(/^.*?\/smartreportservice\/profile\/overview.*?/, 'get', overviewData)
